package com.tzu.ft.transfer.server;

import java.net.ServerSocket;

import com.tzu.ft.base.TransferTools;
import com.tzu.ssl.KeyInfo;

/**
 * 服务端，非ssl
 */
public class FTServer extends Server {


	@Override
	public void init(int port, KeyInfo keyinfo) throws Exception {
		this.port = port;
		// 启动服务
		serverSocket = new ServerSocket(port);
//		serverSocket.setSoTimeout(TransferTools.DEFAULT_SO_TIMEOUT);
//		serverSocket.setReceiveBufferSize(BUFFER_SIZE);
		serverSocket = TransferTools.settingServerSocket(serverSocket);
		System.out
				.println("启动服务：" + serverSocket.getInetAddress().getHostAddress() + ":" + serverSocket.getLocalPort());

	}


	//=========================================================================

	public static void main(String[] args) {
		try {
			FTServer server = new FTServer();
			server.init(TransferTools.DEFAULT_SOCKET_PORT, null);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
